<template>
  <div class="app-container">
    <!-- 查询和其他操作 -->
    <div class="filter-container">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item :label='$t("用户账户")'>
          <el-input v-model="formInline.userName" :placeholder='$t("请输入用户账户")' clearable></el-input>
        </el-form-item>
        <el-form-item :label='$t("会员名称")'>
          <el-input v-model="formInline.memberName" :placeholder='$t("请输入会员名称")' clearable></el-input>
        </el-form-item>
        <el-form-item :label='$t("状态")'>
          <el-select v-model="formInline.status" :placeholder='$t("状态")' clearable>
            <el-option :label='$t("未到期")' value="1"></el-option>
            <el-option :label='$t("已过期")' value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="handleFilter"
            v-permission="['GET /admin/p/member_pay_user_index']">{{ $t('Search') }}
          </el-button>
        </el-form-item>
      </el-form>
    </div>
    <!-- 查询结果 -->
    <el-table v-loading="listLoading" :data="list" border fit highlight-current-row>
      <el-table-column align="center" type="index" :label='$t("序号")' width="50"></el-table-column>
      <el-table-column align="center" :label='$t("用户ID")' prop="userId" />
      <el-table-column align="center" :label='$t("用户账号")' prop="userName" />
      <el-table-column align="center" :label='$t("会员名称")' prop="memberName" />
      <el-table-column align="center" :label='$t("到期时间")' prop="endTime" />
      <el-table-column align="center" :label='$t("状态")' prop="status">
        <template slot-scope="scope">
          <span>{{ $t(scope.row.status == 1 ? '未到期' : '已过期') }}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="formInline.page" :limit.sync="formInline.limit"
      @pagination="getList" />

  </div>
</template>
<script>

import { payMemberUserList } from '@/api/user'
import Pagination from '@/components/Pagination'

export default {
  name: 'PaidMemberList',
  components: { Pagination },
  data() {
    return {
      value1: '',
      formInline: {
        page: 1,
        limit: 20,
        sort: 'add_time',
        order: 'asc'
      },
      list: [],
      total: 0,
      listLoading: false

    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      payMemberUserList(this.formInline).then(response => {
        this.list = response.data.data.content
        this.total = response.data.data.totalElements
        // this.total = response.data.data
        this.listLoading = false
      }).catch(() => {
        this.list = []
        this.listLoading = false
      })
    },
    handleFilter() {
      this.getList()
    }
  }
}
</script>

<style scoped>
.daytime {
  color: #606266;
  font-size: 14px;
  font-weight: 700;
}
</style>
